package chapter02;

import java.util.Scanner;

/**
 * 验证登录信息的合法性
 * 通过equla方法判断两个字符串是否相等
 * Created by a on 2017/6/9.
 */
public class Test029 {
    public static void main(String[] args) {
        while (true) {
            Scanner scanner = new Scanner(System.in);
            System.out.println("请输入登录用户名!");
            String userName = scanner.nextLine();
            System.out.println("请输入登录密码!");
            String passWord = scanner.nextLine();
            if (!userName.equals("mr")) {
                System.out.println("用户名非法");
            } else if (!passWord.equals("mrsoft")) {
                System.out.println("密码错误");
            } else {
                System.out.println("恭喜您,登陆成功");
            }
        }
    }
}
